package com.goodving.guli.utility;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;

/**
 * Created by Administrator on 2015-11-17.
 */
public class LedongliService extends Service {
    public static final String f6034a;
    private BroadcastReceiver f6035b;
    private BroadcastReceiver f6036c;

    static {
        f6034a = LedongliService.class.getSimpleName();
    }

    public static void m11856a(boolean z) {
//        if (z) {
//            C1445h.m11846a().m11848c();
//            C1385a.queryLoginStateFromServer().m11631c();
//            return;
//        }
//        C1445h.m11846a().m11849d();
//        C1385a.queryLoginStateFromServer().m11633e();
    }

    public IBinder onBind(Intent intent) {
        return null;
    }

    public void onCreate() {
        super.onCreate();
//        C1472m.m12013a(f6034a, "LedongliService onCreate");
//        if (C1472m.f6171a) {
//            C1484x.m12111a().m12118a((Context) this);
//            MobclickAgent.setDebugMode(true);
//        }
//        ServiceLauncher.m8760a(C1481u.m12068a());
//        ActivityManagerWrapper.m8619l();
//        C1465g.m11945a();
//        if (C1481u.m12090l() == 0) {
//            ax.m11452a();
//        }
//        C1145a.m8204a().m8210a(C1481u.m12068a());
//        C1145a.m8204a().m8219d();
//        MobclickAgent.openActivityDurationTrack(false);
//        MobclickAgent.updateOnlineConfig(C1481u.m12068a());
//        if (C1481u.m12101w()) {
//            C1445h.m11846a().m11848c();
//            C1385a.queryLoginStateFromServer().m11631c();
//        }
//        m11855a();
//        m11857b();
//        C1297s.m11552a(this);
//        C1300t.m11554a(this);
//        C1286h.m11514a();
    }

    public int onStartCommand(Intent intent, int i, int i2) {
        return 1;
    }

    private void m11855a() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.SCREEN_ON");
        intentFilter.addAction("android.intent.action.SCREEN_OFF");
        this.f6035b = new C1455a(this);
        registerReceiver(this.f6035b, intentFilter);
    }

    private void m11857b() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(C1465g.bj);
        this.f6036c = new C1456b(this);
        registerReceiver(this.f6036c, intentFilter);
    }

    private void m11858c() {
        if (this.f6035b != null) {
            unregisterReceiver(this.f6035b);
        }
    }

    private void m11859d() {
        if (this.f6036c != null) {
            unregisterReceiver(this.f6036c);
        }
    }

    public void onDestroy() {
        super.onDestroy();
//        MobclickAgent.onEvent(this, "MOTION_SERVICE_DESTORY");
//        C1472m.m12015b(f6034a, "Service onDestroy");
//        if (C1481u.m12101w()) {
//            C1445h.m11846a().m11849d();
//        }
        m11858c();
        m11859d();
        startService(new Intent(this, LedongliService.class));
    }
}
